/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import java.io.IOException;
import javax.annotation.PostConstruct;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;


/**
 *
 * @author Wizz
 */
public class LogoutBean {

    private SessionBean sessionBean;
    
    @PostConstruct
    public void init()
    {
        
    }

    public SessionBean getSessionBean()
    {
        return sessionBean;
    }

    public void setSessionBean(SessionBean sessionBean)
    {
        this.sessionBean = sessionBean;
    }

    public void setLogout(ActionEvent e)
    {
        sessionBean.setCurrentUser(null);
        try{
            FacesContext.getCurrentInstance().getExternalContext().redirect("index.jspx");
        }catch(IOException ex){
            ex.printStackTrace();
        }
    }

}
